Add NIx support#203
Open
chinyeungli wants to merge 10 commits into
Open
Conversation
* There are two main functions: get_download_url (system‑specific binary) and get_src_download_url (source tarball). * Avoid using nix to retrieve data whenever possible, but provide a fallback to nix if the non‑Nix method does not yield results. Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* version is now required * better error handling * etc... Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
…-artifact@v7 and actions/download-artifact@v8 with a full-length commit SHA. Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
Signed-off-by: Chin Yeung Li <tli@nexb.com>
* Correct typo * Add tests Signed-off-by: Chin Yeung Li <tli@nexb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference: #201
The code tries to get package metadata from https://search.devbox.sh/v2/. If the package cannot be found there, it will try to use the
nixcommand to retrieve the metadata (ifnixis installed on the host system).It then uses https://cache.nixos.org/ to retrieve the download url such as: https://cache.nixos.org/0kz6msxd62b2hx2pacs1vvl6al5ma3ri.narinfo
Note that there are certain requirements: a system qualifier and version are required.
In addition to getting the download URL of the binary, I've also implemented a function to get the upstream source download URL.
Some samples run:
(Note that the
flakerefqualifier only works forget_upstream_src_download_url, as "cache.nixos.org" only stores official packages, whereasflakerefusually points to third-party locations.)For reference, the official Nix packages can be found at https://search.nixos.org/packages